home *** CD-ROM | disk | FTP | other *** search
- /*
- * The original copyright owners of the accompanying source code files have
- * agreed to place such code into the public domain. Accordingly, anyone
- * who receives or obtains a copy of such source code is freely entitled to
- * reproduce, use and otherwise exploit such code (including the right to
- * make derivative works), at his/her own risk and expense, without any
- * obligation or liability to the original copyright owners.
- *
- * We would appreciate (but do not require) that the following message be
- * included in any derivative works:
- *
- * "Portions of this program were developed by Peter Broadwell, Rob Myers
- * and Robin Schaufler while working in Silicon Valley."
- *
- * The accompanying source code files and related documentation materials
- * are distributed on an "AS IS" basis, without any warranties or
- * guarantees of any kind. All implied warranties, including the implied
- * warranties of merchantability and of fitness for any particular purpose,
- * are expressly disclaimed.
- */
- #include <math.h>
- #include "gl.h"
- #include "device.h"
- #include "geom.h"
- #include "class.h"
- #include "classIds.h"
- #include "selectors.h"
- #include "mbox.h"
- #include "individual.h"
- #include "behavior.h"
- #include "doers.h"
- #include "colors.h"
- #include "objIds.h"
-
- #include "sea.h"
-
- #define PI 3.14159265358979323844
- #define DEG(x) ((float)x*(float)180/PI)
- #define RAD(x) ((float)x*PI/(float)180)
-
- extern char frozen;
- extern char bullet;
-
-
- /* ARGSUSED */
- plantinit(s, argtype, univol)
- register individual *s;
- int argtype;
- point *univol;
- {
- register model *myModel;
- register long i;
- register float f;
-
- replicateModel(s); /* first, instantiate and initialize the model */
- myModel = s->descr; /* use newly instantiated model */
-
- makeobj(LEAF);
- rmvi(10,0,20);
- rpmvi(0,0,0);
- rpdri(0,0,19);
- rpdri(100,0,0);
- rpdri(0,0,-19);
- rpdri(-100,0,0);
- pclos();
- closeobj();
-
- makeobj((Object)myModel);
- pushLongName(s);
- backface(FALSE);
- fishWritemask(BACKGROUND);
- fishColor(myModel->color);
- pushmatrix();
-
- scale(6.0,6.0,4.5);
- /*
- WIMP came into being to get the seaweed to stand up
- straight on the early GT's. Without it it tended to look all bent over
- and WIMPY.
- I don't know what changed in the GL at that time but it seems to be
- needed for all latter machines.
- Take it out if you want to get things to run under "old" GL's.
- It is also used in bubMethods.c, eggMethods.c and pebMethods.c
- always as an inline define (to keep the Makefile simpler).
- */
- #define WIMP
- #ifdef WIMP
- rotate(900, 'y');
- #endif /* WIMP */
- movei(0,0,0);
- for(i=0; i < ((sea *)s)->length; i++) {
- f = i;
- rotate((Angle)(5689 * sin(f*2) * cos(f*3)), 'z');
- callobj(LEAF);
- }
- popmatrix();
- backface(TRUE);
- popLongName();
- closeobj();
- myModel->compiled = TRUE;
- myModel->component = (Object)myModel;
- }
-
-